// @ts-ignore
/* eslint-disable */
import {request} from '@umijs/max';
import {OrganizationListItem, OrganizationListParams} from './data';

/** 获取租户列表 GET /api/organization/list */
export async function organizationList(
    params: {
        // query
        /** 当前的页码 */
        current?: number;
        /** 页面的容量 */
        pageSize?: number;
    },
    options?: { [key: string]: any },
) {
    return request<{
        data: OrganizationListItem[];
        /** 列表的内容总数 */
        total?: number;
        success?: boolean;
    }>('/api/organization/list', {
        method: 'GET',
        params: {
            ...params,
        },
        ...(options || {}),
    });
}

/** 更新租户信息 PUT /api/organization/edit */
export async function organizationEdit(data: { [key: string]: any }, options?: { [key: string]: any }) {
    return request<OrganizationListItem>('/api/organization/edit', {
        data,
        method: 'POST',
        ...(options || {}),
    });
}

/** 新增租户 POST /api/organization/add */
export async function organizationAdd(data: { [key: string]: any }, options?: { [key: string]: any }) {
    return request<OrganizationListItem>('/api/organization/add', {
        data,
        method: 'POST',
        ...(options || {}),
    });
}

/** 更新租户信息 PUT /api/organization/addContract */
export async function organizationAddContract(data: { [key: string]: any }, options?: { [key: string]: any }) {
    return request<OrganizationListItem>('/api/organization/addContract', {
        data,
        method: 'POST',
        ...(options || {}),
    });
}


/** 角色列表 POST /api/sku/detail */
export async function organizationDetail(
    params: {
        organizationId?: string;
    },
    options?: { [key: string]: any },
) {
    return request<{
        data: OrganizationListItem;
    }>('/api/organization/detail', {
        method: 'GET',
        params: {
            ...params,
        },
        ...(options || {}),
    });
}


/** 获取用户选择列表 GET /api/user/selectList */
export async function organizationSelectList(
    params: {
        organizationId?: string;
        includeSystem?: boolean;
    },
    options?: { [key: string]: any },
) {
    return request<{
        data: OrganizationListItem[];
    }>('/api/organization/selectList', {
        method: 'GET',
        params: {
            ...params,
        },
        ...(options || {}),
    });
}


export async function removeOrganization(data: { organizationIds: string[] }, options?: { [key: string]: any }) {
    return request<Record<string, any>>('/api/organization/delete', {
        data,
        method: 'DELETE',
        ...(options || {}),
    });
}
